-- ======================================================================
-- Hell Lua Bus
-- 
-- Copyright 2012-2013Hell-Prototypes
--
-- http://www.hellprototypes.com/
--
-- This is free software, licensed under the terms of the GNU General
-- Public License as published by the Free Software Foundation.
-- ======================================================================
iic = require "mod_fw_iic"
-- -----------------------------------------------------------------------------

if not iic.device_open() then
	print("iic.device_open fail")
	return
end

iic.io_init()
g_raw_data = {}

g_raw_data = iic.read_word_addr_regs(0, 256)

if type(g_raw_data) == "table" then
	for i=1, #g_raw_data do
		io.write("0x" .. string.format("%02x,", g_raw_data[i]):upper())
		if i%16 == 0 then
			print("")
		end
	end
else
	print("g_raw_data not table, fail to read data file")
	return
end


if not iic.device_close() then
	print("iic.device_close fail")
end